<template>
	<view class="goodsList">
		<view class="item" v-for="(item, index) in list" :key="item.id" @click="details(item.id)">
			<divimg :src="item.image" class="img" mode="aspectFill"></divimg>
			<view class="title">
				{{ item.name }}
			</view>
			<view class="subtitle">
				{{ item.desc }}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'goodsList',
		props: {
			list: {
				type: Array,
				default: () => [],
			},
		},
		data() {
			return {};
		},
		methods: {
			details(id) {
				uni.navigateTo({
					url: '/pages/product/details/details?id=' + id,
				});
			},
		},
	};
</script>

<style lang="scss" scoped>
	.goodsList {
		overflow: hidden;
		.item {
			float: left;
			margin: $submargin-width $margin-width;

			width: 330rpx;
			height: 440rpx;
			background: #ffffff;
			border-radius: $border-radius;
			&:nth-child(2n + 1) {
				margin-right: 0;
			}
			.img {
				width: 330rpx;
				height: 330rpx;
			}
			.title {
				font-size: $uni-font-size-12;
				color: #000000;
				margin: 15rpx 15rpx 10rpx;
			}
			.subtitle {
				font-size: $uni-font-size-12;
				margin-left: 15rpx;
				color: #999999;
			}
		}
	}
</style>
